package com.shekhar.paas.domain;

import java.util.Arrays;
import java.util.Date;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection="stories")
public class Story {

    @Id
    private String id;
    
    private String title;
    private String text;
    private String url;
    private Tweet[] tweets;
    private String[] tags;
    private Date creationDate;
    private int tweetCount;
    private int retweetCount;
    private long score;
    private String[] similarStories;

    private Date updatedOn;
    
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getText() {
        return text;
    }
    public void setText(String text) {
        this.text = text;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public Tweet[] getTweets() {
        return tweets;
    }
    public void setTweets(Tweet[] tweets) {
        this.tweets = tweets;
    }
    public String[] getTags() {
        return tags;
    }
    public void setTags(String[] tags) {
        this.tags = tags;
    }
    public Date getCreationDate() {
        return creationDate;
    }
    public void setCreationDate(Date creationDate) {
        this.creationDate = creationDate;
    }
    public int getTweetCount() {
        return tweetCount;
    }
    public void setTweetCount(int tweetCount) {
        this.tweetCount = tweetCount;
    }
    public int getRetweetCount() {
        return retweetCount;
    }
    public void setRetweetCount(int retweetCount) {
        this.retweetCount = retweetCount;
    }
    public long getScore() {
        return score;
    }
    public void setScore(long score) {
        this.score = score;
    }
    public void setLastUpdatedOn(Date updatedOn) {
        this.updatedOn = updatedOn;
    }

    public Date getUpdatedOn() {
        return updatedOn;
    }
    
    @Override
    public String toString() {
        return "Story [title=" + title + ", url=" + url + ", tweets=" + Arrays.toString(tweets) + ", tags="
                + Arrays.toString(tags) + ", creationDate=" + creationDate + ", tweetCount=" + tweetCount + ", retweetCount=" + retweetCount
                + ", score=" + score + "]";
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((url == null) ? 0 : url.hashCode());
        return result;
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Story other = (Story) obj;
        if (url == null) {
            if (other.url != null)
                return false;
        } else if (!url.equals(other.url))
            return false;
        return true;
    }
    public String[] getSimilarStories() {
        return similarStories;
    }
    public void setSimilarStories(String[] similarStories) {
        this.similarStories = similarStories;
    }
    
    
 
    
}
